// pages/myClub/myClub.js
import {
  shopAuditList
} from '@/api/records'
import {showText} from "../../utils/util";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUri: getApp().globalData.imgUri,
    showErcode:false,
    myList:[],
    pageSize:10,
    isEnd: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let t = this;
    t.getMyList();
  },
  getMyList(pageNum = 1) {
    let o = {
      pageNum,
      pageSize: this.data.pageSize,
    }
    shopAuditList(o).then(res => {
      if(res.code == 200){
        var listData = res.data.listData;
        let timestamp = new Date().getTime();
        for(var i=0;i<listData.length;i++){

          if(listData[i].status == 1){
            var status_size = "未审核";
          }else if(listData[i].status == 2){
            var status_size = "已通过";
          }else{
            var status_size = "被驳回";
          }
          listData[i].status_size = status_size;
        }
        let list = this.data.myList.concat(listData)
        let isEnd = list.length >= res.data.total
        this.setData({
          myList: list,
          isEnd,
        })

      }
    });
  },
  bindscrolltolower() {
    console.log('bindscrolltolower')
    let { isEnd } = this.data
    if (!isEnd) {
      let pageNum = Math.ceil(this.data.myList.length / this.data.pageSize) + 1
      this.getMyList(pageNum)
    }
  },
  cli_see(e){
    let t = this;
    let { auditexplain } = e.currentTarget.dataset;
    showText(auditexplain)
  },
  openErcode(){
    this.setData({
      showErcode:true
    })
  },
  closeErcode(){
    this.setData({
      showErcode:false
    })
  },
})